c22ba9
@@ -282,6 +282,8 @@
public class AmqpAppender extends AppenderBase<ILoggingEvent> {
 
 	private TargetLengthBasedClassNameAbbreviator abbreviator;
 
+	private boolean includeCallerData;
+
 	public void setRoutingKeyPattern(String routingKeyPattern) {
 		this.routingKeyLayout.setPattern("%nopex{}" + routingKeyPattern);
 	}
@@ -533,6 +535,21 @@
public class AmqpAppender extends AppenderBase<ILoggingEvent> {
 		this.clientConnectionProperties = clientConnectionProperties;
 	}
 
+	public boolean isIncludeCallerData() {
+		return this.includeCallerData;
+	}
+
+	/**
+	 * If true, the caller data will be available in the target AMQP message.
+	 * By default no caller data is sent to the RabbitMQ.
+	 * @param includeCallerData include or on caller data
+	 * @since 1.7.1
+	 * @see ILoggingEvent#getCallerData()
+	 */
+	public void setIncludeCallerData(boolean includeCallerData) {
+		this.includeCallerData = includeCallerData;
+	}
+
 	@Override
 	public void start() {
 		ConnectionFactory rabbitConnectionFactory = createRabbitConnectionFactory();
@@ -638,6 +655,9 @@
public class AmqpAppender extends AppenderBase<ILoggingEvent> {
 
 	@Override
 	protected void append(ILoggingEvent event) {
+		if (isIncludeCallerData()) {
+			event.getCallerData();
+		}
 		this.events.add(new Event(event));
 	}
 
@@ -793,7 +813,6 @@
public class AmqpAppender extends AppenderBase<ILoggingEvent> {
 		public Event(ILoggingEvent event) {
 			this.event = event;
 			this.properties = this.event.getMDCPropertyMap();
-			this.event.getCallerData();
 		}
 
 		public ILoggingEvent getEvent() {
